<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./lib/jquery.js"></script>
    <script src="./lib/template-web.js"></script>
  </head>
  <body>
    <div class="box"></div>
    <!-- 模板引擎 -->
    <script type="text/html" id="qwerdf">
      <h3>时间:{{regTime | Format}}</h3>
    </script>
        <!-- 定义数据 -->
    <script>
      var data = { regTime: new Date() };
      // 定义处理时间的过滤器
      template.defaults.imports.Format = function (date) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        var d = date.getDate();
        return y + "-" + m + "-" + d;
      };
    //   $('.box').html(template('qwerdf',data))
    let htmlts = template('qwerdf',data)
    $('.box').html(htmlts)
    </script>
  </body>
</html>
